<template>
  <div class="order-wrapper">
    <showDicom :needUploadBtn="false" :fileList="fileList" />

    <el-form ref="form" :model="form" label-width="80px" size="mini">
      <el-row>
        <el-col :span="12">
          <el-form-item label="影像描述" prop="desc" style="width: 500px">
            <el-input
              type="textarea"
              v-model="form.desc"
              :autosize="{ minRows: 4 }"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="参考意见" prop="desc" style="width: 500px">
            <el-input
              type="textarea"
              v-model="form.opinion"
              :autosize="{ minRows: 4 }"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>

      <el-form-item size="large">
        <el-button type="primary" @click="onSubmit">提交信息</el-button>
        <el-button @click="reset">信息重置</el-button>
        <el-button @click="print">打印pdf</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import showDicom from "../../components/showDicom/showDicom_New"
import { getPdf } from "@/utils"

export default {
  components: {
    showDicom
  },
  name: "upload",
  data () {
    return {
      id: this.$route.query.id,
      form: {
        desc: "",
        opinion: ""
      },
      fileList: []
    }
  },
  async mounted () {
    this.getDcm()
  },
  methods: {
    reset () {
      this.form.desc = ""
      this.form.opinion = ""
    },
    async getDcm () {
      if (this.id) {
        const result = await this.$request.getDcmInfo({
          id: this.id
        })
        this.fileList = result.data
      }
    },
    onSubmit () {
      this.$request.submit({
        id: Number(this.id),
        dcmAccount: this.form.desc,
        doctorOpinion: this.form.opinion
      })
      this.$message({
        message: "提交成功",
        type: "success"
      })
      this.$router.push({ path: "/dataTable" })
    },
    print () {
      getPdf(".order-wrapper", "报告")
    }
  }
}
</script>

<style lang="scss">
.avatar-uploader .el-upload {
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.avatar-uploader .el-upload:hover {
  border-color: #409eff;
}
.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 178px;
  height: 178px;
  line-height: 178px;
  text-align: center;
}
.avatar {
  width: 178px;
  height: 178px;
  display: block;
}
h3 {
  margin: 55px 0 20px;
  font-weight: 400;
  color: #1f2f3d;
  font-size: 22px;
}
p {
  font-size: 14px;
  color: #5e6d82;
  line-height: 1.5em;
}
</style>


